#ifndef SCHEDULER_H
#define SCHEDULER_H

#include "process_management.h"
#include "null.h"
#include "types.h"
#include "dynamic_memory.h"
#include "error_codes.h"
#include "timer.h"

/* global variables  */

PCB* running; /* the current running process */

/* functions declarations */

/* initializes the scheduler's data structures */
void initialize_scheduler();

/* inserts the pointer on the PCB pcb in the ready queue.
   The insertion keeps the queue sorted by priority.
   Returns OUT_OF_MEMORY if there is not enough memory for the new link, SUCCESS otherwise
*/
int32_t insert_ready_queue(PCB* pcb, int reschedule);

/* removes pcb from the ready queue
   Returns SUCCESS if the operation succeeded, FAILURE otherwise.
*/
int32_t remove_ready_queue(PCB* pcb);

/* returns the first process of the ready queue (or NULL) */
PCB* get_first();

/* returns running */
PCB* get_running();

/* selects the process that is to be run according to our policy */
void schedule();

#endif
